﻿#ifndef HRIBBONELEMENTCREATEDELEGATE_H
#define HRIBBONELEMENTCREATEDELEGATE_H
#include "HRibbonGlobal.h"
#include <QColor>
#include <QMargins>
#include <QSize>
class QWidget;
class HRibbonBar;
class HRibbonTabBar;
class HRibbonApplicationButton;
class HRibbonCategory;
class HRibbonContextCategory;
class HRibbonPannel;
class HRibbonSeparatorWidget;
class HRibbonGallery;
class HRibbonGalleryGroup;
class HRibbonToolButton;
class HRibbonControlButton;
class HRibbonButtonGroupWidget;
class HRibbonStackedWidget;
class HRibbonQuickAccessBar;
class HRibbonPannelOptionButton;



/**
 * @brief 定义了saribbon所有尺寸相关信息，saribbon的建立都基于此类的尺寸，如果想调整，
 * 可以通过 @ref HRibbonElementCreateDelegate 的 @ref setRibbonStyleOption 函数设置自己的HRibbonStyleOption
 *
 * 一般HRibbonElementCreateDelegate::setRibbonStyleOption函数最好在ribbonbar构建之前调用
 */
class HRIBBON_EXPORT HRibbonStyleOption {
public:
    HRibbonStyleOption();
    int mainbarHeightOfficeStyleThreeRow;   ///< OfficeStyle 样式下的mainbar高度
    int mainbarHeightWPSStyleThreeRow;      ///< WpsLiteStyle 样式下的mainbar高度
    int mainbarHeightOfficeStyleTwoRow;     ///< OfficeStyleTwoRow 样式下的mainbar高度
    int mainbarHeightWPSStyleTwoRow;        ///< WpsLiteStyleTwoRow 样式下的mainbar高度
    int titleBarHight;                      ///< 标题栏高度
    int tabBarHight;                        ///< ribbon tab 的高度
    QColor titleTextColor;                  ///< 标题颜色
    QMargins widgetBord;                    ///< 整个ribbonbar的四个边框，默认为0
    QColor tabBarBaseLineColor;             ///< tabbar 底部线条颜色
    int applicationButtonWidth;             ///< applicationButton的宽度，高度随tab bar高度
    int galleryFixedHeight;                 ///< HRibbonGallery控件的高度
    int galleryMinimumWidth;                ///< HRibbonGallery控件的最小宽度
    int galleryButtonMaximumWidth;          ///< HRibbonGallery控件的最右边三个按钮的最大宽度，默认为15
    int pannelTitleHeight;                  ///< HRibbonPannel标题栏的高度
    QSize toolButtonLargeIconSize;          ///< HRibbonToolButton的Large模式的icon 尺寸
    QSize toolButtonSmallIconSize;          ///< HRibbonToolButton的Medium和small模式的icon 尺寸
};

///
/// \brief HRibbon的子元素创建的代理，HRibbon内部创建子元素都通过HRibbonElementCreateDelegate来创建
/// 如果有些子元素重载，如HRibbonCategory，可以重载此类的createRibbonCategory,返回重载的类来进行重载
///
class HRIBBON_EXPORT HRibbonElementCreateDelegate
{
public:
    HRibbonElementCreateDelegate();
    virtual ~HRibbonElementCreateDelegate();
    virtual HRibbonTabBar *createRibbonTabBar(QWidget *parent);
    virtual HRibbonApplicationButton *createRibbonApplicationButton(QWidget *parent);
    virtual HRibbonCategory *createRibbonCategory(QWidget *parent);
    virtual HRibbonContextCategory *createRibbonContextCategory(QWidget *parent);
    virtual HRibbonPannel *createRibbonPannel(QWidget *parent);
    virtual HRibbonSeparatorWidget *createRibbonSeparatorWidget(int value, QWidget *parent);
    virtual HRibbonSeparatorWidget *createRibbonSeparatorWidget(QWidget *parent);
    virtual HRibbonGallery *createRibbonGallery(QWidget *parent);
    virtual HRibbonGalleryGroup *createRibbonGalleryGroup(QWidget *parent);
    virtual HRibbonToolButton *createRibbonToolButton(QWidget *parent);
    virtual HRibbonStackedWidget *createRibbonStackedWidget(HRibbonBar *parent);

    //创建隐藏ribbon的按钮代理函数
    virtual HRibbonControlButton *createHidePannelButton(HRibbonBar *parent);
    virtual HRibbonButtonGroupWidget *craeteButtonGroupWidget(QWidget *parent);
    virtual HRibbonQuickAccessBar *createQuickAccessBar(QWidget *parent);

    //
    virtual const HRibbonStyleOption& getRibbonStyleOption() const;
    virtual void setRibbonStyleOption(HRibbonStyleOption *opt);

    //创建HRibbonPannelOptionButton
    virtual HRibbonPannelOptionButton *createRibbonPannelOptionButton(HRibbonPannel *pannel);

private:
    HRibbonStyleOption *m_opt;
};

#endif // HRIBBONELEMENTCREATEDELEGATE_H
